Java Working Shapes
import java.awt.event.*; import java.awt.*; public class GraphicsDemo extends Frame{ public GraphicsDemo(){ addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent we){ System.exit(0); } }); } public void paint(Graphics g){ g.drawLine(20,50,100,80); g.drawLine(20,60,100,80); g.drawRect(20,150,60,50); g.fillRect(110,150,50,60); g.drawRoundRect(200,150,60,60,15,15); g.fillRoundRect(290,150,60,50,30,40); g.drawOval(20,250,50,50); g.fillOval(100,250,75,50); g.drawOval(200,260,100,40); g.drawArc(20,350,70,70,0,180); g.fillArc(70,350,70,70,0,75); int xpoints[] = {20,200,20,200,20}; int ypoints[] = {450,450,650,650,450}; int num = 5; g.drawPolygon(xpoints,ypoints,num); } public static void main(String[] args){ GraphicsDemo app = new GraphicsDemo(); app.setSize(new Dimension(370,700)); app.setTitle("Shapes"); app.setVisible(true); } }